﻿@model List<pdtransport_v2._0.Models.Xe>
@{
    ViewBag.Title = "DanhSach";
    Layout = "~/Areas/back/Views/Shared/_back_layout.cshtml";
}

<h2>Danh sách xe</h2>

<br />
<div class="dataTables_filter" id="example_filter">
<form class="form-search" method="get">
<input name="keyword" type="text" placeholder="Từ khóa"/>
<button type="submit" class="btn btn-small btn-blue">Tìm</button>
</form>
</div>

<p>
    @Html.ActionLink("Thêm mới", "Them", "Xe", new { @class = "btn btn-small btn-blue"})
</p>

<table class="data display datatable">
<thead>
    <tr>
        <th class="sorting_asc">
            Xe
        </th>
        <th class="sorting">
            BKS
        </th>
        <th class="sorting">
            Miền
        </th>
        <th class="sorting">
            Loại hình dịch vụ
        </th>
        <th class="sorting">
            Loại xe
        </th>
        <th class="sorting">
            Tình Trạng
        </th>
        <th width="7%">
        </th>
        <th width="7%">
        </th>
    </tr>
</thead>
<tbody>
@if (ViewBag.total_row == 0)
{
    <tr class="gradeA odd">
        <td colspan="5" class="align-center">
            Không có kết quả phù hợp
        </td>
    </tr>
}

@foreach (var item in Model)
{
    <tr class="gradeA odd">
        <td>
            @item.TenXe1.TenXe1
        </td>
        <td>
            @item.BKS
        </td>
        <td>
            @item.Mien1.TenMien
        </td>
        <td>
            @item.TenXe1.LoaiHinhDichVu.TenLHDV
        </td>
        <td>
            @item.TenXe1.LoaiXe1.LoaiXe1
        </td>
        <td>
            @switch (item.TinhTrang)
            {
                    case 0:
                    <span class="label label-inverse">Disabled</span>
                    break;
                    case 1:
                    <span class="label label-success">Enabled</span>
                    break;
                    default:
                    <span class="label label-important">Deleted</span>
                    break;

            }
        </td>
        <td>
            @Html.ActionLink("Sửa", "Sua", "Xe", new { idxe = item.IDXe }, new { @class = "btn btn-small btn-blue" })
        </td>
        <td>
        @if (item.TinhTrang != 2)
        {
            @Html.ActionLink("Xóa", "Xoa", "Xe", new { idxe = item.IDXe}, new { @class = "btn btn-small btn-red delete-row" })
        }
        else
        {
            @Html.ActionLink("Xóa", "", "", new { idxe = item.IDXe }, new { @class = "btn btn-small btn-red disabled" })
        }
        </td>
    </tr>
}
</tbody>
</table>

<div class="pagination clearfix">
        @if ((string)ViewData["pageLinks"] != "")
        {
            <ul>
                @Html.Raw(ViewBag.pageLinks)
            </ul>
            <br />
            <br />
        }
    </div>
